package com.kitchen.ui.controls.account
{
	import com.kitchen.ui.controls.Portrait;
	
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;

	public class HeadBar extends Sprite
	{
		private var mainSkin:BitmapData;
		private var shoper:Object;
		private var shops:Array;
		private var shop:Object;
		private var nickTf:TextField;
		private var levelTf:TextField;
		public function HeadBar(main:BitmapData, shoper:Object, shops:Array, shop:Object)
		{
			super();
			this.mainSkin = main;
			this.shop = shop;
			this.shoper = shoper;
			this.shops = shops;
			this.layout();
		}
		
		private function layout():void{
			var bg:HeadBgIcon = new HeadBgIcon(this.mainSkin);
			this.addChild(bg);
			this.nickTf = new TextField();
			
			var tff:TextFormat = new TextFormat();
			tff.align = TextFormatAlign.LEFT;
			tff.font = '黑体';
			tff.size = 12;
			tff.bold = true;
			tff.color = 0xbc612c;
			this.nickTf.text = String(this.shoper.sUname).substring(0, 6);
			this.nickTf.setTextFormat(tff);
			this.nickTf.width = 80;
			this.nickTf.height = 18;
			this.nickTf.x = 48;
			this.nickTf.y = 8;
			this.addChild(this.nickTf);
			
			this.levelTf = new TextField();
			var tff2:TextFormat = new TextFormat();
			tff2.align = TextFormatAlign.LEFT;
			tff2.font = '黑体';
			tff2.bold = true;
			tff2.size = 12;
			tff2.color = 0xffffff;
			this.levelTf.defaultTextFormat = tff2;
			this.levelTf.text = 'LV'+String(this.shop.shop.nLevel).substring(0, 3);
			this.levelTf.selectable = false;
			this.levelTf.height = 18;
			this.levelTf.width = 32;
			this.levelTf.y = 7;
			this.levelTf.x = 136;
			this.addChild(this.levelTf);
			
			var portrait:Portrait = new Portrait(this.shoper.sPhoto);
			portrait.y = 6;
			portrait.x = 8;
			portrait.addEventListener(MouseEvent.CLICK, clickHandle);
			this.addChild(portrait);
			
			var diamond:DiamondIcon = new DiamondIcon(this.mainSkin);
			diamond.x = 172;
			diamond.y = 6;
			this.addChild(diamond);
			
			var medal:MedalIcon = new MedalIcon(this.mainSkin);
			medal.x = 202;
			medal.y = 6;
			this.addChild(medal);
		}
		
		public function show():void{
			
		}
		
		private function clickHandle(me:MouseEvent):void{
			
		}
		
	}
}